import request from '@/utils/request';
// 获取分类列表
const getCategory = async (pramas = {}) => {
	const url = $globalRequestUrl({
		url: '/index/category?pid=0',
	});
	return await request({
		url,
		method: 'get',
	})
};

const getRecommendList = async (pramas = {}) => {
	const url = $globalRequestUrl({
		url: `/article?page=${pramas.page}&size=${pramas.size}`,
	});
	return await request({
		url,
		method: 'get',
	})
};

// 角色列表
const getWorldBookList = async (params) => {
	const url = $globalRequestUrl({
		url: `/characters`,
	});
	return await request({
		url,
		method: 'get',
    params
	})
};
// 分类列表 这里传递的是一级分类
const getWorldCategoryList = async (pid) => {
	const url = $globalRequestUrl({
		url: `/index/category?pid=${pid}`,
	});
	return await request({
		url,
		method: 'get',
	})
};
const getSettings = async (key) => {
  const url = $globalRequestUrl({
    url: `/system/setting?key=${key}`,
  });
  return await request({
    url,
    method: 'get',
  })
};

export { getCategory, getRecommendList, getWorldBookList, getWorldCategoryList, getSettings };
